package com.itbaizhan.clouddemooauth2server.config;

import org.springframework.security.crypto.password.PasswordEncoder;

public class CustomEncoder implements PasswordEncoder {


    /**
     * 原样输出客户密码(不对它进行加密)
     * @param rawPassword
     * @return
     */
    @Override
    public String encode(CharSequence rawPassword) {

        return  rawPassword.toString();
    }

    /**
     * 密码验证
     * @param rawPassword
     * @param encodedPassword
     * @return
     */
    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(rawPassword.toString());
    }
}
